home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / digclk12 / digclock.frm < prev    next >
Text File  |  1995-05-02  |  9KB  |  301 lines

  1. VERSION 2.00
  2. Begin Form frmClock 
  3.    BorderStyle     =   1  'Fixed Single
  4.    ClientHeight    =   735
  5.    ClientLeft      =   3240
  6.    ClientTop       =   855
  7.    ClientWidth     =   2730
  8.    ControlBox      =   0   'False
  9.    ForeColor       =   &H00FF0000&
  10.    Height          =   1140
  11.    Icon            =   DIGCLOCK.FRX:0000
  12.    Left            =   3180
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    Picture         =   DIGCLOCK.FRX:0302
  17.    ScaleHeight     =   735
  18.    ScaleWidth      =   2730
  19.    Top             =   510
  20.    Width           =   2850
  21.    Begin PictureClip picNumbers 
  22.       Cols            =   13
  23.       Location        =   "3705,525,1170,-60"
  24.       Picture         =   DIGCLOCK.FRX:0520
  25.    End
  26.    Begin SSPanel pnlClock 
  27.       BackColor       =   &H00C0C0C0&
  28.       BevelInner      =   1  'Inset
  29.       BevelWidth      =   2
  30.       Font3D          =   3  'Inset w/light shading
  31.       ForeColor       =   &H00800000&
  32.       Height          =   735
  33.       Left            =   0
  34.       TabIndex        =   0
  35.       Top             =   0
  36.       Width           =   2730
  37.       Begin PictureBox picClock 
  38.          BackColor       =   &H00000000&
  39.          BorderStyle     =   0  'None
  40.          Height          =   525
  41.          Left            =   105
  42.          ScaleHeight     =   525
  43.          ScaleWidth      =   2505
  44.          TabIndex        =   1
  45.          Top             =   105
  46.          Width           =   2505
  47.          Begin Image imgNum 
  48.             Height          =   525
  49.             Index           =   7
  50.             Left            =   2205
  51.             Top             =   0
  52.             Width           =   285
  53.          End
  54.          Begin Image imgNum 
  55.             Height          =   525
  56.             Index           =   6
  57.             Left            =   1890
  58.             Top             =   0
  59.             Width           =   285
  60.          End
  61.          Begin Image imgNum 
  62.             Height          =   525
  63.             Index           =   5
  64.             Left            =   1575
  65.             Top             =   0
  66.             Width           =   285
  67.          End
  68.          Begin Image imgNum 
  69.             Height          =   525
  70.             Index           =   0
  71.             Left            =   0
  72.             Top             =   0
  73.             Width           =   285
  74.          End
  75.          Begin Image imgNum 
  76.             Height          =   525
  77.             Index           =   1
  78.             Left            =   315
  79.             Top             =   0
  80.             Width           =   285
  81.          End
  82.          Begin Image imgNum 
  83.             Height          =   525
  84.             Index           =   2
  85.             Left            =   630
  86.             Top             =   0
  87.             Width           =   285
  88.          End
  89.          Begin Image imgNum 
  90.             Height          =   525
  91.             Index           =   3
  92.             Left            =   945
  93.             Top             =   0
  94.             Width           =   285
  95.          End
  96.          Begin Image imgNum 
  97.             Height          =   525
  98.             Index           =   4
  99.             Left            =   1260
  100.             Top             =   0
  101.             Width           =   285
  102.          End
  103.       End
  104.    End
  105.    Begin Timer Timer1 
  106.       Interval        =   1000
  107.       Left            =   3120
  108.       Top             =   1680
  109.    End
  110.    Begin Image imgGreen 
  111.       Height          =   525
  112.       Left            =   0
  113.       Picture         =   DIGCLOCK.FRX:168E
  114.       Top             =   1920
  115.       Width           =   3705
  116.    End
  117.    Begin Image imgRed 
  118.       Height          =   525
  119.       Left            =   0
  120.       Picture         =   DIGCLOCK.FRX:27FC
  121.       Top             =   2400
  122.       Width           =   3705
  123.    End
  124. End
  125. Option Explicit
  126.  
  127. Sub cmdEnd_Click ()
  128.  
  129. End Sub
  130.  
  131. Sub Form_Load ()
  132. Dim Success%
  133. Dim Temp
  134. Dim ReturnString As String
  135. Dim ReturnSize As Integer
  136. Dim CurrentPath As String
  137. Dim TempString As String
  138.  
  139.  
  140.  
  141. ReturnString = Space$(128)
  142. ReturnSize = Len(ReturnString)
  143. Temp = GetPrivateProfileString("DigClock", "Left", "0", ReturnString, ReturnSize, "digclock.ini")
  144. ReturnString = Left(ReturnString, Temp)
  145. Me.Left = Val(ReturnString)
  146. ReturnString = Space$(128)
  147. Temp = GetPrivateProfileString("DigClock", "Top", "0", ReturnString, ReturnSize, "digclock.ini")
  148. ReturnString = Left(ReturnString, Temp)
  149. Me.Top = Val(ReturnString)
  150. ReturnString = Space$(128)
  151. Temp = GetPrivateProfileString("DigClock", "Color", "0", ReturnString, ReturnSize, "digclock.ini")
  152. ReturnString = Left(ReturnString, Temp)
  153. If Val(ReturnString) = 0 Then
  154.    picNumbers.Picture = imgRed.Picture
  155.    ClockColor = 0
  156. Else
  157.    picNumbers.Picture = imgGreen.Picture
  158.    ClockColor = 1
  159. End If
  160. ReturnString = Space$(128)
  161. Temp = GetPrivateProfileString("DigClock", "TimeFormat", "12", ReturnString, ReturnSize, "digclock.ini")
  162. ReturnString = Left(ReturnString, Temp)
  163. If Val(ReturnString) = 12 Then
  164.    TimeFormat = 12
  165. Else
  166.    TimeFormat = 24
  167. End If
  168.  
  169. ReturnString = Space$(128)
  170. Temp = GetPrivateProfileString("DigClock", "OnTop", "0", ReturnString, ReturnSize, "digclock.ini")
  171. ReturnString = Left(ReturnString, Temp)
  172. If Val(ReturnString) = 1 Then
  173.    Success% = SetWindowPos(frmClock.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
  174.    OnTop = 1
  175. Else
  176.    Success% = SetWindowPos(frmClock.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
  177.    OnTop = 0
  178. End If
  179.  
  180. ReturnString = Space$(128)
  181. Temp = GetPrivateProfileString("DigClock", "SecondsOn", "0", ReturnString, ReturnSize, "digclock.ini")
  182. ReturnString = Left(ReturnString, Temp)
  183. If Val(ReturnString) = 1 Then
  184.    picClock.Width = 2500
  185.    pnlClock.Width = 2730
  186.    Me.Width = 2765
  187.    SecondsOn = 1
  188.    ' Turn on Colons
  189.    imgNum(2).Picture = picNumbers.GraphicCell(10)
  190.    imgNum(5).Picture = picNumbers.GraphicCell(10)
  191.  
  192. Else
  193.    picClock.Width = 1560
  194.    pnlClock.Width = 1770
  195.    Me.Width = 1800
  196.    SecondsOn = 0
  197. End If
  198. Load frmOptions
  199. End Sub
  200.  
  201. Sub Form_Unload (Cancel As Integer)
  202. Dim Temp
  203. Dim TempString As String
  204. TempString = Trim(Str(Me.Left))
  205. Temp = WritePrivateProfileString("DigClock", "Left", TempString, "digclock.ini")
  206. TempString = Trim(Str(Me.Top))
  207. Temp = WritePrivateProfileString("DigClock", "Top", TempString, "digclock.ini")
  208. TempString = Trim(Str(OnTop))
  209. Temp = WritePrivateProfileString("DigClock", "OnTop", TempString, "digclock.ini")
  210. TempString = Trim(Str(ClockColor))
  211. Temp = WritePrivateProfileString("DigClock", "Color", TempString, "digclock.ini")
  212. TempString = Trim(Str(TimeFormat))
  213. Temp = WritePrivateProfileString("DigClock", "TimeFormat", TempString, "digclock.ini")
  214. TempString = Trim(Str(SecondsOn))
  215. Temp = WritePrivateProfileString("DigClock", "SecondsOn", TempString, "digclock.ini")
  216.  
  217. End
  218. End Sub
  219.  
  220. Sub imgNum_MouseUp (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  221. Dim mpos As POINTAPI
  222. Dim p As ConvertPOINTAPI
  223. Dim ret As Integer
  224.  
  225. Call GetCursorPos(mpos) ' Get the current position of the cursor
  226. LSet p = mpos           ' and convert it for SendMessage calls.
  227.  
  228. ' Now tell the form someone is clicking the window caption:
  229. ret = Sendmessage(Me.hWnd, WM_SYSCOMMAND, MOUSE_MOVE, p.xy)
  230. End Sub
  231.  
  232. Sub Picture1_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  233. Dim mpos As POINTAPI
  234. Dim p As ConvertPOINTAPI
  235. Dim ret As Integer
  236.  
  237. Call GetCursorPos(mpos) ' Get the current position of the cursor
  238. LSet p = mpos           ' and convert it for SendMessage calls.
  239.  
  240. ' Now tell the form someone is clicking the window caption:
  241. ret = Sendmessage(Me.hWnd, WM_SYSCOMMAND, MOUSE_MOVE, p.xy)
  242. End Sub
  243.  
  244. Sub pnlClock_DblClick ()
  245. frmOptions.Show
  246. End Sub
  247.  
  248. Sub pnlMenu_DblClick ()
  249. frmOptions.Show
  250. End Sub
  251.  
  252. Sub Timer1_Timer ()
  253. Dim Current
  254. Dim X As Integer
  255. If TimeFormat = 12 And SecondsOn = 0 Then
  256.    Current = Format(Now, "HH:MM AM/PM")
  257. End If
  258. If TimeFormat = 24 And SecondsOn = 0 Then
  259.    Current = Format(Now, "HH:MM")
  260. End If
  261.  
  262. If TimeFormat = 12 And SecondsOn = 1 Then
  263.    Current = Format(Now, "HH:MM:SS AM/PM")
  264. End If
  265. If TimeFormat = 24 And SecondsOn = 1 Then
  266.    Curre